import request from './request'
import tConfig from '@/config'

// 文件上传
export const uplaodFile = {
  url: `${tConfig.API_URL}/upload`,
  name: '文件上传',
  post: async function(data, config = {}) {
    return await request.post(this.url, data, config)
  }
}

// 获取文件列表
export const getFilelist = {
  url: `${tConfig.API_URL}/file/list`,
  name: '获取文件列表',
  get: async function(params) {
    return await request.get(this.url, params)
  }
}

// 获取文件分类
export const getFileCategory = {
  url: `${tConfig.API_URL}/file/menu`,
  name: '获取文件分类',
  get: async function() {
    return await request.get(this.url)
  }
}

export default {
  upload: {
		url: `${tConfig.API_URL}/upload`,
		name: "文件上传",
		post: async function(data, config = {}){
			return await request.post(this.url, data, config)
		}
	},
	uploadFile: {
		url: `${tConfig.API_URL}/uploadFile`,
		name: "附件上传",
		post: async function(data, config = {}) {
			return await request.post(this.url, data, config)
		}
	},
	exportFile: {
		url: `${tConfig.API_URL}/fileExport`,
		name: "导出附件",
		get: async function(data, config = {}) {
      console.log('this.url------',tConfig)
			return await request.get(this.url, data, config)
		}
	},
	importFile: {
		url: `${tConfig.API_URL}/fileImport`,
		name: "导入附件",
		post: async function(data, config = {}) {
			return await request.post(this.url, data, config)
		}
	}
}